package com.javastudy.liuhouse.bank_demo;

import java.util.Scanner;

public class BankManagementSystem {
    public static void main(String[] args) {
        //创建一个输入对象
        Scanner scanner = new Scanner(System.in);
        //创建一个银行账户
        BankAccount account = new BankAccount("17691107518", "liuhouse", 1000.00);
        //使用while循环,开启系统的循环
        while (true){
            System.out.println("\n请选择操作：");
            System.out.println("1.存款");
            System.out.println("2.取款");
            System.out.println("3.查询余额");
            System.out.println("4.查看账户信息");
            System.out.println("5.退出");
            System.out.print("请输入选项:");
            //接受输入的参数值
            int choice = scanner.nextInt();
            switch (choice){
                case 1:
                    System.out.println("请输入存款金额:");
                    double depositAmount = scanner.nextDouble();
                    //使用账户的对象调用存款的方法
                    account.deposit(depositAmount);
                    break;
                case 2:
                    System.out.println("请输入取款金额:");
                    double withdrawAmount = scanner.nextDouble();
                    account.withdraw(withdrawAmount);
                    break;
                case 3:
                    account.checkBalance();
                    break;
                case 4:
                    account.getAccountInfo();
                    break;
                case 5:
                    System.out.println("退出系统:");
                    scanner.close();
                    return;
                default:
                    System.out.println("无效选项,请重新选择。");

            }

        }
    }
}
